package org.jing.ext.spring.component;

import org.jing.core.logger.JingLogger;
import org.jing.core.util.StringUtil;

import java.io.InputStream;
import java.io.OutputStream;

/**
 * Description: <br>
 *
 * @author bks <br>
 * @since 2023-01-28 <br>
 */
// @Component("socketClient")
@Deprecated
public class ExampleSocketDispatcher extends BaseSocketDispatcher {
    private static final JingLogger LOGGER = JingLogger.getLogger(ExampleSocketDispatcher.class);

    @Override public String getClientName() {
        return "测试Socket分发器";
    }

    @Override protected void operation(InputStream inputStream, OutputStream outputStream) throws Throwable {
        LOGGER.debug(StringUtil.readFromInputStream(inputStream, "gbk"));
        outputStream.write("hello world".getBytes("gbk"));
    }
}
